﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Coolite.Ext.Web;

namespace WebUI
{
    public partial class CooliteTest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ToolbarButton2.AjaxEvents.Click.Event += new ComponentAjaxEvent.AjaxEventHandler(UpdateTimeStamp);
            ToolbarButton2.AjaxEvents.Click.EventMask.ShowMask = true;
            ToolbarButton2.AjaxEvents.Click.EventMask.MinDelay = 500;
            ToolbarButton2.AjaxEvents.Click.EventMask.Msg = "load...";

            //ToolbarButton2.Listeners.Click.Handler = "Coolite.AjaxMethods.UpdateTimeStamp();";

            //ScriptManager1.CustomAjaxEvents.Add(new AjaxEvent("ToolbarButton2", "OnEvent", new ComponentAjaxEvent.AjaxEventHandler(UpdateTimeStamp)));

            if (!Ext.IsAjaxRequest)
            {
                Window1.Title = "测试窗体";
                //ToolbarButton2.Listeners.Click.Delay = 1000;
                //ToolbarButton2.Listeners.Click.Handler = "#{Window1}.load('http://www.sina.com.cn/');";
            }
        }

        [AjaxMethod]
        protected void UpdateTimeStamp(object sender, AjaxEventArgs e)
        {
            Ext.Msg.Alert("test", Window1.AutoLoad.Url).Show();
            //Window1.LoadContent("http://www.sina.com.cn/");
            //Window1.AutoLoad.Url = "http://www.sina.com.cn/";
            //Ext.Msg.Alert("test", Window1.AutoLoad.Url).Show();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Window1.Collapse();
        }

    }
}
